#include <bits/stdc++.h>
#define double long double
using namespace std;
const double eps = 1e-9;
const int N = 1e6+5;
int n;
double h[N],r[N],R[N],hh[N],ans;
pair<double,double> get(double x1,double y1,double x2,double y2)
{
    double k,b;
    k = (y1-y2)/(x1-x2);
    b = y1-k*x1;
    return {k,b};
}
bool ok(double xa1,double ya1,double xa2,double ya2,double xb1,double yb1,double xb2,double yb2)
{
    if(xa1>xa2) swap(xa1,xa2),swap(ya1,ya2);
    if(xb1>xb2) swap(xb1,xb2),swap(yb1,yb2);
    auto ra = get(xa1,ya1,xa2,ya2),rb = get(xb1,yb1,xb2,yb2);
    double ka = ra.first,ba = ra.second,kb = rb.first,bb = rb.second;
    if(fabs(ka-kb)<eps) return 1;
    double x = (bb-ba)/(ka-kb);
    // cout<<ka<<' '<<ba<<' '<<kb<<' '<<bb<<'\n';
    // cout<<"RES"<<x<<'\n';
    if(x>=xa1&&x>=xb1&&x<=xa2&&x<=xb2) return 0;
    return 1;
}
double put(int x,int y)
{
    // cout<<x<<"->"<<y<<'\n';
    if(r[x]>R[y]) return h[y];
    auto rx = get(r[x]/2,0,R[x]/2,h[x]),ry = get(r[y]/2,0,R[y]/2,h[y]);
    if(r[x]<r[y])
    {
        if(ok(r[x]/2,0,R[x]/2,h[x],r[y]/2,0,R[y]/2,h[y])) return 0;
        // if()
    }
    else
    {
        double addh = ry.first*(r[x]/2)+ry.second;
        // cout<<ry.first<<'\n';
        if(rx.first>ry.first) return addh;
    }
    if(R[x]<R[y]) return (R[x]/2*ry.first+ry.second)-h[x];
    // cout<<rx.first<<' '<<rx.second<<'\n';
    // cout<<"ok"<<h[y]<<' '<<h[1]<<' '<<(y==1)<<' '<<(R[y]/2*rx.first+rx.second);
    return h[y]-(R[y]/2*rx.first+rx.second);
}
int stk[N],top;
signed main()
{
	freopen("wan.in","r",stdin);
	freopen("wan.out","w",stdout);
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cout<<fixed<<setprecision(10);
    cin>>n;
    for(int i = 1;i<=n;i++)
        cin>>h[i]>>r[i]>>R[i];
    stk[++top] = 1,ans = h[1];
    for(int i = 2;i<=n;i++)
    {
        while(top)
        {
            int p = top,pp = stk[top];
            bool fl = 1;
            double addh = put(i,pp);
            // top--;
            while(top&&R[top]<=R[i])
            {
                if(!ok(r[stk[top]]/2,hh[stk[top]],R[stk[top]]/2,hh[stk[top]]+h[stk[top]],r[i]/2,hh[pp]+addh,R[i]/2,hh[pp]+addh+h[i])&&top!=p)
                {
                    fl = 0;
                    break;
                }
                top--;
            }
            if((!top||R[top]>r[i])&&fl)
            {
                // cout<<pp<<'\n';
                hh[i] = hh[pp]+addh;
                break;
            }
        }
        // cout<<hh[i]<<'\n';
        while(top&&hh[stk[top]]+h[stk[top]]<hh[i]+h[i]) top--;
        // cout<<"tp"<<top<<'\n';
        stk[++top] = i;
        ans = max(ans,hh[i]+h[i]);
    }
    cout<<ans;
	return 0;
}